package com.yayan.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 获取文件上传路径
 * @author 刘超
 *
 */
public class FilePathUtil {
	
	private static Properties prop = null;
	private static String configFile = "upload.properties";
	private static String filePath = null;
	private static String codePath = null;
	private static String notifyUrl = null;
	
	static{
		InputStream in = null;
		prop = new Properties();
		try{
			in = FilePathUtil.class.getClassLoader().getResourceAsStream(configFile);
			prop.load(in);
			filePath = prop.getProperty("path");
			codePath = prop.getProperty("codepath");
			notifyUrl = prop.getProperty("notifyUrl");
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			if(in != null){
				try {
					in.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
	
	public static String getFilePath(){
		return filePath;
	}
	
	public static String getValue(String key){
		return prop.getProperty(key);
	}
	
	public static String getCodePath() {
		return codePath;
	}
	
	public static String getNotifyUrl() {
		return notifyUrl;
	}

}
